import React from 'react';
import { DatePicker } from 'antd';

const datePicker = (props, ref) => {
  let { value, onChange, fieldProps = {} } = props;
  
  return (
    <DatePicker
      allowClear={true}
      style={{ width: '100%' }}
      onChange={(date, dateString) => {
        onChange && onChange(date)
      }}
      value={value}
      {...fieldProps}
    />
  );
};

export default React.forwardRef(datePicker);
